package ms.utils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class DataBag implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private Map<String, Object> bags = new HashMap<String, Object>();
	
	public <T> T get(String itemName) {
		return get(itemName, null);
	}
	
	@SuppressWarnings("unchecked")
	public <T> T get(String itemName, T defaultValue) {
		return bags.containsKey(itemName) ? (T) bags.get(itemName) : defaultValue;
	}
	
	public <T> void set(String itemName, T value) {
		bags.put(itemName, value);
	}
}
